<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // 把多个实参--转为   每次传入一个参数

        // function sum(a, b) {
        //     return a + b;
        // }




        function sum(a) {

            // a 形参是 局部变量
            return function (b) {
                return a + b;
            }
        }

        // var r = sum(1, 2);

        // var fn = sum(1);

        // var r = fn(2)
        // console.log(r);


        /* 
        fn = ƒ (b) {
                return a + b;
            }
        
        */
        var fn = sum(1);

        console.log(fn);

        var r = fn(2);
        console.log(r);
    </script>

</body>

</html>